import { request_baseURL } from '../config/url.config'
import axios from 'axios';
window.axios = axios;

axios.defaults.baseURL = request_baseURL;
axios.defaults.headers = {'Cache-Control': 'no-cache'};
axios.defaults.timeout = 60000;
axios.defaults.withCredentials = true;
const CancelToken = axios.CancelToken;

axios.interceptors.request.use(config => {
  const source = CancelToken.source();
  config.cancelToken = source.token;
  return config;
}, error => {
  console.log(error);
});

const request = axios;

export { request }